varying vec3 n; varying vec4 p;
void main() {
    vec3 nhat = normalize(n);
    vec3 l = normalize(gl_LightSource[0].position – p.xyz);
    vec3 v = -normalize(p);		/* eye is at origin */
    vec3 h = normalize(l + v);
    vec4 c = gl_FrontMaterial.ambient*gl_LightSource[0].ambient;
    c += max(0,dot(n,l))*gl_FrontMaterial.diffuse*gl_LightSource[0].diffuse;
    int f;
    if (dot(n,l) > 0.0) f = 1.0; else f = 0.0;
    c += f*pow(max(0,dot(n,h)),gl_FrontMaterial.shininess) *
    gl_FrontMaterial.specular*gl_LightSource[0].specular;
    gl_FragColor = c;
}
